package com.atguigu.tingshu.album.config;

import io.minio.MinioClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.print.attribute.standard.PrinterURI;

/**
 * @author: atguigu
 * @create: 2023-10-17 10:45
 */
@Configuration
public class MinIOConfig {

    @Autowired
    private MinioConstantProperties props;


    /**
     * 注册操作MInIO客户端对象
     * @return
     */
    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                .endpoint(props.getEndpointUrl()) //操作MinIO地址 端口9000
                .credentials(props.getAccessKey(), props.getSecreKey())
                .build();
    }

}
